/**
 * 
 */
package cc.dogtailflower.framework.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import cc.dogtailflower.framework.exception.AppException;

/**
 * 流操作工具类
 * @author cc
 *
 */
public class StreamUtil {

	/*
	 * inputStream 转 string
	 */
	public static String getStringFormInputStream(InputStream is){
		StringBuilder sb = new StringBuilder();
		try{
			BufferedReader reader = new BufferedReader(new InputStreamReader(is));
			String line;
			while((line = reader.readLine()) != null){
				sb.append(line);
			}
		}catch(Exception e){
			e.printStackTrace();
			throw new AppException(e.getMessage());
		}
		
		
		
		return sb.toString();
	}
}
